<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="./dist/css/zx-editor.css">
		<style>
			body {
				margin: 0;
				padding: 0;
			}
			
			#editorContainer {
				padding: 15px;
				/*box-sizing: border-box;*/
			}
		</style>
	</head>

	<body>
		<!--头部-->
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: #000;"></a>
			<a style="color: #000;float: right;line-height: 44px;font-size: 16px;" id="save_note">完成</a>
		</header>
		<!--标题-->
		<form class="mui-input-group">
			<div class="mui-input-row">
				<input type="text" id="notesName" class="mui-input-clear" placeholder="点击输入标题" style="border: none;">
			</div>
		</form>
		<!--文本内容-->
		<div class="mui-input-row">
			<div id="editorContainer"></div>
		</div>

		<script src="https://cdnjs.cloudflare.com/ajax/libs/js-polyfills/0.1.42/polyfill.min.js"></script>
		<script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
		<script src="./dist/js/zx-editor.js"></script>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript" src="js/jquery-3.4.1.js"></script>
		<script type="text/javascript">
		mui.init()
			//完成按钮	
			
		function plusReady(){
            // 在这里调用plus api
            	var token=plus.storage.getItem('accessToken');
           
		         
		         $("#save_note").click(function() {
		         	 	alert(aaa);
				//后台提交
					console.log(zxEditor.getHtml());
					console.log($("#notesName").val());
					
					$.ajax({
						url: "http://343bdb1.cpolar.io/note-notes/notes/saveNores?token="+token,
						type: "post",
						data: {
							notesName : $("#notesName").val(),
							content : zxEditor.getHtml()
						},
						success: function() {
							
							mui.toast('新建成功',{ duration:'long', type:'div' }) 
							//mui.back();	
						},
						error:function() {
							alert(aaa)
						}
					});
					
			})
		         
        }
			
			
			
			// 实例化 ZxEditor
			var zxEditor = new ZxEditor('#editorContainer', {
				editable: true,
				placeholder: '请输入正文',
			})
			
			// 实例化 VConsole
        new VConsole()
			
		</script>
	</body>

</html>